package com.virtual;
import com.manage.*;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDateTime;

public class Run {
    private List<ClassRoom> classes;

    public Run() {
        this.classes = new ArrayList<>();
    }

    // 班级管理
    public void addClass(ClassRoom newClass) {
        classes.add(newClass);
    }

    public void removeClass(ClassRoom classRoom) {
        classes.remove(classRoom);
    }

    // 导出成绩
    public void exportScores(ClassRoom classRoom) {
        // TODO: 实现导出成绩的逻辑
        System.out.println("Exporting scores for class: " + classRoom.getName());
        for (Group group : classRoom.getGroups()) {
            System.out.println("Group: " + group.getName() + ", Score: " + group.getScore());
            for (Student student : group.getMembers()) {
                System.out.println("Student: " + student.getName() + 
                                 ", ID: " + student.getId());
                // 打印答题记录
                for (AnswerRecord record : student.getAnswerRecords()) {
                    System.out.println("Answer Record - Date: " + record.getDateTime() + 
                                     ", Score: " + record.getScore());
                }
            }
        }
    }

    // 获取班级列表
    public List<ClassRoom> getClasses() {
        return classes;
    }
}
